package com.wl.shixun5.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 数据库连接工具类
 */
public class Bookjdbc_Util {
    public static Connection getConnection() {
        Connection cnn = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        try {
            cnn = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/bookstore?"
                + "useUnicode=true&characterEncoding=UTF-8", 
                "root", 
                "a15207291068");
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return cnn;
    }
}
